[Silverlight] How to choose the webcam resolution

Posted by Benjamin Roux on ASP.net Weblogs See other posts from ASP.net Weblogs or by Benjamin Roux
Published on Thu, 03 Feb 2011 17:54:23 GMT Indexed on 2011/02/03 23:26 UTC
Read the original article Hit count: 329

Filed under:
|
|

Hello,

Today I’m gonna show you how to choose the webcam resolution when using Silverlight. By default most of them are in 640x480 which can be sometimes insufficient.

VideoCaptureDevice source = devices.SelectedItem as VideoCaptureDevice; 
source.DesiredFormat = new VideoFormat(PixelFormatType.Unknown, 4096, 4096, 30);

The magic thing with this line, is that the camera will choose the best resolution available (and not absolutely 4096x4096).

You can also get all the supported formats using the SupportedFormats property.

Hope this help.

© ASP.net Weblogs or respective owner

Related posts about Microsoft

Related posts about Silverlight